<?php

function formatPage($pageData){
    return [
        'total' => $pageData->total(),
        'item' => $pageData->items(),
        'page' => $pageData->currentPage(),
        'limit' => $pageData->perPage(),
    ];
}

function resSucc($data, $msg){
    return response()->json([
        "code"=> 0,
        "msg"=> $msg,
        "data"=> $data
    ]);
}

function resFail($data, $msg, $code = -1){
    return response()->json([
        "code"=> $code,
        "msg"=> $msg,
        "data"=> $data
    ]);
}
